$(function () {
    let id = localStorage.getItem("serviceId");
    findByTypeId(id);
});
function findByTypeId(id) {
    $.ajax({
        url: '/back/service/findByTypeId',
        data: {id: id},
        type: 'get',
        dataType: 'json',
        success: function (data) {
            showData(data.serviceItemsModel);
        }
    })
}
//打开编辑页面 直接给里面选项进行赋值
function showData(data) {
    $("#serviceId").val(data.id);
    $("#serviceType").val(data.serviceType);
    $("#showHref").val(data.showHref);
}
function serviceEdit() {
    var data = {};
    data.id=$("#serviceId").val();
    data.serviceType=$("#serviceType").val();
    data.showHref=$("#showHref").val();
    $.ajax({
        url: '/back/service/serviceEdit',
        data: data,
        type: 'post',
        dataType: 'json',
        success: function (data) {
            if (data.result === 1) {
                alert("提交成功");
                $("#right").load('/back/service/serviceManage.html');
            } else {
                alert("提交失败")
            }
        }
    })
}
